using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace tafei_thingsapi.Models
{
    [Index(nameof(DeviceNumber), IsUnique = true)]
    public class Device
    {
        public int Id { get; set; }
        
        [Required]
        [StringLength(50)]
        public string DeviceNumber { get; set; }
        
        [Required]
        public string Name { get; set; }
        
        [Required]
        public string Type { get; set; }
        
        public DateTime CreatedAt { get; set; } = DateTime.Now;
        
        [Required]
        public int OwnerId { get; set; }
        
        [ForeignKey("OwnerId")]
        public User Owner { get; set; }

        [NotMapped]
        public string Status { get; set; }

        [NotMapped]
        public string videoUrl { get; set; }
    }
}